home *** CD-ROM | disk | FTP | other *** search
/ New Masters of Flash / New Masters of Flash.iso / pc / MOVIES / 11.dir / 00061_Text_text056.txt < prev    next >
Text File  |  2000-10-01  |  3KB  |  38 lines

  1. Altering and Displaying the Sizes of the Cells.
  2. Finally, we need to think about setting and placing the nine movie symbols to predetermined sizes and positions, based on the lengths of the edges of the cells established in the previous step. The movie clip placement and the instance name are as shown in the earlier figure. For the sake of convenience, the whole of the matrix comprising the nine cells is set as a movie symbol with the instance name tenkey (the standard Japanese term for the numeric keypad), and the movie symbols key 1 to key 9 of the different cells are placed in the lower layer. 
  3. First, letΓÇÖs look at setting the cellsΓÇÖ sizes, which involves nothing more complicated than setting PX1 to 3 for the vertical edges and PY1 to 3 for the horizontal edges. The next piece of script designates, in sequence, percentages for the sizes of cells grouped by row as follows: key 1 to key 3, key 4 to key 6, and key 7 to key 9. These are the default values for the cell sizes, with the initial setting at frame 1 being a constant designated as 60.
  4.  
  5. i =1
  6. while (i<=3) {
  7. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add i, _xscale, eval(ΓÇ£PXΓÇ¥ add i)*100/L);
  8. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add i, _yscale PY1*100/L);
  9. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add (i+3), _xscale) eval(ΓÇ£PXΓÇ¥ add i)*100/L);
  10. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add (i+3), _yscale) PY2*100/L);
  11. setProperty (ΓÇ£/tenkey/keyΓÇ¥add (i+6), _xscale) eval(ΓÇ£PXΓÇ¥ add i)*100/L);
  12. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add (i+6), _yscale) PY3*100/L);
  13. i =i+1;
  14. }
  15.  
  16. If you have more matrices, youΓÇÖll have to build a more elegant multiple loop, but, since weΓÇÖre looking at three rows and three columns, I have used this rather less elegant but easy to understand script.
  17. Next, weΓÇÖll look at placing the cell in the desired position. For this, we need to achieve a seamless line up, in accordance with the sizes of the cells, from the bottom-left position of the matrix, in sequence vertically and horizontally. First of all, the term for the initial setting of frame 1 is: 
  18.  
  19. drawX1 =getProperty (ΓÇ£/tenkey/key1ΓÇ¥, _x);
  20. drawY1 =getProperty (ΓÇ£/tenkey/key1ΓÇ¥, _y);
  21. The bottom left co-ordinates,drawX1, drawY1, are designated as constants. Next, the placement is done in accordance with the sizes of the cells. This is how it looks when converted into script: 
  22.  
  23. drawX2 =drawX1+PX1;
  24. drawX3 =drawX2+PX2;
  25. drawY2 =drawY1-PY1;
  26. drawY3 =drawY2-PY2;
  27. i = 2;
  28. while (i<=3) {
  29. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add i,_x, eval(ΓÇ£drawXΓÇ¥ add i));
  30. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add (i+3), _x eval(ΓÇ£drawXΓÇ¥ add i));
  31. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add (i+6), _x eval(ΓÇ£drawXΓÇ¥ add i));
  32. setproperty (ΓÇ£/tenkey/keyΓÇ¥ add (i*3-2), _y =eval(ΓÇ£drawYΓÇ¥ add i));
  33. setProperty (ΓÇ£/tenkey/keyΓÇ¥ add (i*3-1), _y =eval(ΓÇ£drawYΓÇ¥ add i));
  34. setProperty (ΓÇ£/tenkey/keyΓÇ¥add (i*3), _y =eval(ΓÇ£drawYΓÇ¥ add i));
  35. i =i+1;
  36. }
  37.  
  38. With that, the main script is fully complete.